#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main() {
    int n = 0;
    while (scanf("%d", &n) != EOF)
    {
        int x[n];
        for (int i = 2; i <= n; i++)
        {
            x[i - 2] = i;
        }
        for (int i = 2; i <= n; i++)
        {
            for (int j = i - 1; j <= n; j++)
            {
                if (x[j] % i == 0)
                {
                    x[j] = 0;
                }
            }
        }

        int num = 0;

        for (int i = 0; i < n - 1; i++)
        {
            if (x[i] == 0)
            {
                num++;
            }
            else {
                printf("%d ", x[i]);
            }
        }
        printf("\n%d", num);
    }
    return 0;
}